import 'dart:io';

import 'package:flutter/material.dart';

class FunctionDemoPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    isShow(1);
    isEnable(false);
    var future = getVersion();

    return Scaffold(
      appBar: AppBar(
        title: Text('方法'),
      ),
      body: Container(
        alignment: Alignment.center,
        child: Text('测试'),
      ),
    );
  }

  isShow(int val){
    return val == 0;
  }

  void isEnable(bool show, {int val = 0, double money = 0.0}) {
    print(show);
    print(val);

    int i = 1;
    int j = 2;
    print(i / j);
    print(i ~/ j);
    print(i % j);
  }

  Future getVersion() async {
    return await getLocalVersion();
  }

  String getLocalVersion() {
    int time = DateTime.now().millisecondsSinceEpoch;
    print("sleep start...");
    sleep(Duration(seconds: 3));
    print("sleep end:${DateTime.now().millisecondsSinceEpoch - time}");
    return "V1.0.0";
  }
}